﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace GPCSC.Web.CL_POST_S
{
    public partial class Modify : Page
    {       

        		protected void Page_Load(object sender, EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				#warning 代码生成提示：显示页面,请检查确认该语句是否正确
				ShowInfo();
			}
		}
			
	private void ShowInfo()
	{
		GPCSC.BLL.CL_POST_S bll=new GPCSC.BLL.CL_POST_S();
		GPCSC.Model.CL_POST_S model=bll.GetModel();
		this.lblCL_POST_SOID.Text=model.CL_POST_SOID.ToString();
		this.txtPOSTNAME.Text=model.POSTNAME;
		this.txtREMARK.Text=model.REMARK;
		this.txtstatus.Text=model.status.ToString();
		this.txtDepth.Text=model.Depth.ToString();
		this.lblCL_PARPOSTID_PK.Text=model.CL_PARPOSTID_PK.ToString();
		this.txtPARPOSTNAME.Text=model.PARPOSTNAME;
		this.txtTab.Text=model.Tab;
		this.txtNumber.Text=model.Number.ToString();
		this.lblPD_CompanyInfoSOID_PK.Text=model.PD_CompanyInfoSOID_PK.ToString();
		this.txtPD_CompanyName.Text=model.PD_CompanyName;

	}

		public void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtPOSTNAME.Text.Trim().Length==0)
			{
				strErr+="POSTNAME不能为空！\\n";	
			}
			if(this.txtREMARK.Text.Trim().Length==0)
			{
				strErr+="REMARK不能为空！\\n";	
			}
			if(!PageValidate.IsNumber(txtstatus.Text))
			{
				strErr+="status格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtDepth.Text))
			{
				strErr+="Depth格式错误！\\n";	
			}
			if(this.txtPARPOSTNAME.Text.Trim().Length==0)
			{
				strErr+="PARPOSTNAME不能为空！\\n";	
			}
			if(this.txtTab.Text.Trim().Length==0)
			{
				strErr+="Tab不能为空！\\n";	
			}
			if(!PageValidate.IsNumber(txtNumber.Text))
			{
				strErr+="Number格式错误！\\n";	
			}
			if(this.txtPD_CompanyName.Text.Trim().Length==0)
			{
				strErr+="PD_CompanyName不能为空！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			Guid CL_POST_SOID= new Guid(this.lblCL_POST_SOID.Text);
			string POSTNAME=this.txtPOSTNAME.Text;
			string REMARK=this.txtREMARK.Text;
			int status=int.Parse(this.txtstatus.Text);
			int Depth=int.Parse(this.txtDepth.Text);
			Guid CL_PARPOSTID_PK= new Guid(this.lblCL_PARPOSTID_PK.Text);
			string PARPOSTNAME=this.txtPARPOSTNAME.Text;
			string Tab=this.txtTab.Text;
			int Number=int.Parse(this.txtNumber.Text);
			Guid PD_CompanyInfoSOID_PK= new Guid(this.lblPD_CompanyInfoSOID_PK.Text);
			string PD_CompanyName=this.txtPD_CompanyName.Text;


			GPCSC.Model.CL_POST_S model=new GPCSC.Model.CL_POST_S();
			model.CL_POST_SOID=CL_POST_SOID;
			model.POSTNAME=POSTNAME;
			model.REMARK=REMARK;
			model.status=status;
			model.Depth=Depth;
			model.CL_PARPOSTID_PK=CL_PARPOSTID_PK;
			model.PARPOSTNAME=PARPOSTNAME;
			model.Tab=Tab;
			model.Number=Number;
			model.PD_CompanyInfoSOID_PK=PD_CompanyInfoSOID_PK;
			model.PD_CompanyName=PD_CompanyName;

			GPCSC.BLL.CL_POST_S bll=new GPCSC.BLL.CL_POST_S();
			bll.Update(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","list.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
